package com.enjoy;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;

public class EnjoyServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        BufferedReader reader = req.getReader();

        String str;
        while ((str = reader.readLine()) != null) {
            System.out.println(str);
        }

        resp.getWriter().write("hello,success find enjoy!");
    }

    @Override
    public void init() throws ServletException {
        super.init();
    }


    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        super.service(req, res);
        BufferedReader reader = req.getReader();
        String str;
        while ((str = reader.readLine()) != null) {
            System.out.println(str);
        }
    }
}
